﻿
namespace SvCore;

public static class CoreHash
{
    public static uint HashMsg<T>()
    {
        var str = typeof(T).Name;
        return HashMsg(str);
    }
    public static uint HashMsg(string str)
    {
        return HashMsg(System.Text.Encoding.Default.GetBytes(str));
    }
    public static uint HashMsg(byte[] byteArray)
    {
        uint seed = 131;
        uint result = 0;
        foreach (byte b in byteArray)
        {
            result = result * seed + b;
        }
        return result;
    }
}